package com.leyou.common.vo;

import com.leyou.common.exceptions.LyException;
import lombok.Data;
import org.joda.time.DateTime;

/**
 * 用来封装返回前端的json格式数据
 */
@Data
public class ExceptionResult {
    private int status;
    private String message;
    private String timestamp;

    public ExceptionResult(LyException e) {
        this.status = e.getStatus();
        this.message = e.getMessage();  //此处message也为枚举中message,继承于RuntimeException,因为 super(e.getMessage(), cause); 向RuntimeException有参构造中传入了枚举中的自定义的message
        this.timestamp = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
    }
}
